Skip to content

runtime: native-payload transport core and link tokens (net P0) - #12064

Closed
proggeramlug wants to merge 1 commit into
mainfrom
net-transport-p0
Closed

proggeramlug wants to merge 1 commit into
mainfrom
net-transport-p0

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

Refs #11919, Refs #11196

Phase P0 of the net transport ownership design. It adds runtime and perry-ffi support for native payloads that own a socket transport, so perry-ext-net can drop its id-keyed tables in phase A.

  • TransportCore sits first in TransportPayload<E>.
  • Link tokens: each token packs route, op and the cell address. A completion goes from its token to link_event_owner, then to the core, then through a generational handle check. There is no id map.
  • Liveness: each completion the driver still owes holds one link_ref, so a payload holding a driver handle cannot be swept until the handle's Closed has been dispatched. Drop never reaches the driver.
  • close: it hands the handle to the driver. A stale Closed arriving after a reopen delivers only its close event and its unref.
  • C ABI: js_perry_payload_* and js_perry_net_link_*, with a layout digest that covers the opaque core block (39 words; 48 on Windows). The net ABI version is now 3.
  • Id-routed subsystems keep their maps until they convert in phases A–C.

Tests:

  • Runtime: 5099 passed, 0 failed (8 new). Codegen: 2545 passed, 0 failed.
  • Witnesses N1, N5, N6, N7, N10 and N11, plus the layout digest check. Each one's sabotage turns it red.

Programs, n=3: hello, tsc and Zod produce identical output on both arms. Instructions are within +0.11% / −0.05%, and RSS is within ±1.5 MB.

Not covered: the Windows paths are written but were not compiled on any host. A compile-time size assert guards the core block size.

@coderabbitai

coderabbitai Bot commented Oct 5, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Bring net transport P0 (#12064, #11919) onto 8476086. Keep current
PayloadVTable, PayloadBuffer support, stream state record, native-this
alias and ServerResponse payload ABI; extend that ABI rather than add
P0's older duplicate implementation.

TransportCore is inline at offset zero of TransportPayload<E>. Tokens
carry route/op/cell, terminal driver completions retain the cell, close
hands the handle to the driver, and generational handles and resolver ops
protect reopen. Link teardown discards completions before heap teardown.
Keep id routes for subsystems that have not migrated; add no id/cell alias.

Use MaybeUninit words for opaque FFI storage and check its ABI before
initialization. Expose binding owner links, lifecycle and typed reopen
through the shared cell/vtable. A checked route store preserves the live
multishot read. Runtime witnesses cover N1, N5, N6, N7, N9, N10, N11,
and the runtime half of N8, with nine sabotages that turn them red.

Phase A's ext-net and HTTP connection conversion remains separate work.
proggeramlug pushed a commit that referenced this pull request Oct 9, 2026
Bring net transport P0 (#12064, #11919) onto 8476086. Keep current
PayloadVTable, PayloadBuffer support, stream state record, native-this
alias and ServerResponse payload ABI; extend that ABI rather than add
P0's older duplicate implementation.

TransportCore is inline at offset zero of TransportPayload<E>. Tokens
carry route/op/cell, terminal driver completions retain the cell, close
hands the handle to the driver, and generational handles and resolver ops
protect reopen. Link teardown discards completions before heap teardown.
Keep id routes for subsystems that have not migrated; add no id/cell alias.

Use MaybeUninit words for opaque FFI storage and check its ABI before
initialization. Expose binding owner links, lifecycle and typed reopen
through the shared cell/vtable. A checked route store preserves the live
multishot read. Runtime witnesses cover N1, N5, N6, N7, N9, N10, N11,
and the runtime half of N8, with nine sabotages that turn them red.

Phase A's ext-net and HTTP connection conversion remains separate work.
@proggeramlug

Copy link
Copy Markdown
Contributor Author

Superseded by #12267 (P0 plus phase A landed together). Follow-ups are tracked in the netfix fix-forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant